import { ref, nextTick } from "vue";
import { addWindowResizeHandler } from "@/utils/index";

export default function () {
  // 动态高度
  let scrollerHeight = ref(0);

  // 动态计算高度
  let calculatedAltitude = (value) => {
    scrollerHeight.value = window.innerHeight - value + "px";
    addWindowResizeHandler(() => {
      nextTick(() => {
        scrollerHeight.value = window.innerHeight - value + "px";
      });
    });
  };

  return { scrollerHeight, calculatedAltitude };
}
